
package swa.e_store.userInterface;

import java.awt.Container;
import java.awt.Dimension;
import javax.swing.JFrame;

import swa.e_store.ENUM.EmployeeState;

/**
 * The GraphicalUI class represents the main screen after login. This user
 * interface dynamically builds up the corresponding menuitems and
 * functionbuttons depending the employee State of the user logged in.
 *
 * The user interface logic and control is emigrated to a seperate logic file
 * 'class LogicUI'
 * 
 * @author Stean Schibig (stefan.schibig@stud.hslu.ch)
 */
public class GraphicalUI extends JFrame {

    private EmployeeState eState;
    private LogicUI mainUI_Logic;

    public GraphicalUI(EmployeeState eState){
        // Initialize attributes
        this.eState = eState;
        // Create new logic file for controlling the mainUserInterface. 
        this.mainUI_Logic = new LogicUI(this);
        
        // initialize components
        this.initComponents();
        setVisible(true);
    }

    /**
     * Initializes the GUI components
     */
    private void initComponents() {
        setJMenuBar(mainUI_Logic.createMenubar(getEmployeeState()));
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setSize(500,400);
    }

    /**
     * @return the empState
     */
    protected EmployeeState getEmployeeState() {
        return eState;
    }
}
